package com.itheima.day08;
import java.util.Scanner;
public class Test3 {
    public static void main(String[] args) {
/*
请编写程序，由键盘录入一个字符串，统计字符串中英文字母和数字分别有多少个。
比如：Hello12345World中字母：10个，数字：5个。
 */
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入字符串:");
        String str = sc.nextLine();
        int engcount = 0;
        int numcount = 0;
        char[] ch = str.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            if (ch[i] >= '0' && ch[i] <= '9') {
                numcount++;
            } else if ((ch[i] >= 'a' && ch[i] <= 'z') || (ch[i] >= 'A' && ch[i] <= 'Z')) {
                engcount++;
            }
        }
        System.out.println("数字字符串有" + numcount + "个");
        System.out.println("字母字符串有" + engcount + "个");
    }
}
